import SpaceTeamMember from "@/components/SpaceTeamMember";
import React, { useState } from "react";
import { Button, Input } from "antd";

const TeamMemberSelectorDemo: React.FC = () => {
  const [spaceId, setSpaceId] = useState(1);

  const handleSwitchSpace = () => {
    setSpaceId((prev) => (prev === 1 ? 2 : 1)); // 切换 spaceId
  };

  const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const value = parseInt(e.target.value, 10);
    if (!isNaN(value)) {
      setSpaceId(value);
    }
  };

  return (
    <div>
      <SpaceTeamMember spaceId={spaceId} />
      <Button onClick={handleSwitchSpace} style={{ marginTop: 16 }}>
        切换 Space ID（当前: {spaceId}）
      </Button>
      <Input
        type="number"
        placeholder="输入 Space ID"
        value={spaceId}
        onChange={handleInputChange}
        style={{ marginTop: 16, width: 200 }}
      />
    </div>
  );
};

export default TeamMemberSelectorDemo;
